package reply

import (
	"bytes"
	"strconv"
	"godis/interface/redis"
)

var (
	nullBulkReplyBytes = []byte("$-1")

	CRLF = "\r\n"
)

/* ---- Bulk Reply ---- */

// BulkReply stores a binary-safe string
type BulkReply struct {
	Arg []byte
}

//MakeBulkReply 
func MakeBulkReply(arg []byte) *BulkReply {
	return &BulkReply{
		Arg:arg,
	}
}

//ToBytes marshal redis.Reply
func (r *BulkReply) ToBytes() []byte {
	if len(r.Arg) == 0 {
		return nullBulkReplyBytes
	}
	return []byte("$" + strconv.Itoa(len(r.Arg)) + CRLF + string(r.Arg) + CRLF)
}

/* ---- Multi Bulk Reply ---- */

// MultiBulkReply stores a list of string


